package org.fhm.zdte.common.standard;

import org.fhm.zdte.common.pojo.Address;
import org.fhm.zdte.common.protocol.AbstractMessageStandard;

/**
 * The standard for communication channel managers.
 *
 * @author 谭波
 * @since 2023/11/27
 */
public interface IChannelManager {

    /**
     * Open communication channel.
     *
     * @param port Socket port.
     * @return Channel manager.
     */
    IChannelManager openChannel(int port);

    /**
     * Enable communication channel.
     */
    void enableChannel();

    /**
     * Send a packet by channel.
     *
     * @param message Packet.
     * @param isa     The address of the receiver side.
     */
    void sendMessage(AbstractMessageStandard message, Address isa);

    /**
     * Initialize channel manager.
     */
    void initializeChannelManager();

    /**
     * Close channel.
     */
    void closeChannel();

}
